﻿using System.Net;

namespace HttpWrapper;

public class ForwardingHttpCall
{
    public HttpClient? Client { get; set; }

    public HttpRequestMessage? Request { get; set; }

    public HttpResponseMessage? Response { get; set; }

    public async Task<HttpResponseMessage> SendAsync()
    {
        if(Client == null)
        {
            throw new InvalidOperationException("client is not created");
        }
        if(Request == null)
        {
            throw new InvalidOperationException("request is not created");
        }

        return Response = await Client.SendAsync(Request);
    }
}
